<template>
  <!--优惠活动标签-->
  <div style="background:white">
    <!--领取优惠券-->
    <div class="preferential" style="text-align: left" v-if="type == 'conpon' && couponListCanBeGet.length">
      <label class="aui-label-danger aui-label-outlined" style="margin-left: 0.5rem">用券</label>
      <span class="cjy-sec-title">      {{'可用优惠券' + couponListCanBeGet.length}}张</span>
      <a @click="getDiscountCoupon"> 领取优惠券</a>
    </div>


    <!--满赠-->
    <div v-if=" buyPresent.length >0 && (item.prefWay==2 ||item.prefWay==1)  "
         v-for="(item ,index) in buyPresent "

         @click="showFree(item)"
         style="text-align: left">

      <buy-more-list :goodsType="goodsType"
                     :goodsUnit="goodsUnit"
                     pageType="cartList"
                     slot="content"
                     :buyMoreDetail="item">
      </buy-more-list>

    </div>

    <!--满赠NG-->
    <div v-if=" buyPresentNG.length >0 "
         v-for="(item,index) in buyPresentNG"

         class="preferential " style="text-align: left">
      <label class="aui-label-danger aui-label-outlined" style="margin-left: 0.5rem">买赠</label>
      <span class="cjy-sec-title">
        {{buyPresentDes(2,item)}}
    </span>
      <a v-if="item.beUsed == 1 && item.prefRange != 1" @click="goClassify(item)">去凑单</a>
      <!--<span v-else-if="item.beUsed == 3" class="cjy-sec-title">可参与次数不足</span>-->
    </div>

    <!--满赠UN-->
    <div v-if=" buyPresentUN.length >0 "
         v-for="(item,index) in buyPresentUN"

         class="preferential " style="text-align: left">
      <label class="aui-label-danger aui-label-outlined" style="margin-left: 0.5rem">买赠</label>
      <span class="cjy-sec-title">
        {{buyPresentDes(2,item)}}
    </span>
      <!-- <span class="cjy-span">勾选后参加</span> -->
    </div>


    <!--阶梯赠品-->
    <div @click=" showBuyMoreLadder(item)"
         v-if=" buyPresent.length >0 && selectLadderList && item.prefWay==3"
         v-for="(item, index) in buyPresent"

         class="preferential" style="text-align: left">

      <label class="aui-label-danger aui-label-outlined" style="margin-left: 0.5rem">买赠</label>
      <span
        class="cjy-sec-title">  {{
        findSelectGift(selectGiftList, item).giftVO ? findSelectGift(selectGiftList, item).giftVO.giftName : '未选择优惠赠品'
        }}   </span>
      <a v-if=" findSelectGift(selectGiftList, item).giftVO"> 已选</a>
      <a v-else> 去选取</a>
    </div>

    <!--多买-->
    <div v-if=" overBuy.length >0 "
         v-for="(item,index) in overBuy" class="preferential"
         style="text-align: left">
      <label class="aui-label-danger aui-label-outlined" style="margin-left: 0.5rem">多买</label><span
      class="cjy-sec-title">{{overBuyDes(1,item)}}</span>
      <span class="cjy-span">已选</span>
    </div>

    <!--多买NG-->
    <div v-if=" overBuyNG.length >0 "
         v-for="(item,index) in overBuyNG"
         class="preferential" style="text-align: left">
      <label class="aui-label-danger aui-label-outlined" style="margin-left: 0.5rem">多买</label> <span
      class="cjy-sec-title">{{overBuyDes(2,item)}}

    </span>
      <a v-if="item.beUsed == 1  && item.prefRange != 1" @click="goClassify(item)"> 去凑单</a>
      <!--<span v-else-if="item.beUsed == 3" class="cjy-sec-title">可参与次数不足</span>-->
    </div>

    <!--多买UN-->
    <div v-if=" overBuyUN.length >0 "
         v-for="(item,index) in overBuyUN"
         class="preferential" style="text-align: left">
      <label class="aui-label-danger aui-label-outlined" style="margin-left: 0.5rem">多买</label> <span
      class="cjy-sec-title">{{overBuyDes(3,item)}}

    </span>
      <!-- <span class="cjy-span">勾选后参加</span> -->
    </div>

    <!--换购-->
    <div @click=" showSelectLadder(item.promotLadderVOList)" v-if="  item.prefWay  == 3 "
         v-for="(item, index) in rebate"
         class="preferential" style="text-align: left">

      <label class="aui-label-danger aui-label-outlined" style="margin-left: 0.5rem">返利</label>
      <span class="cjy-sec-title">
        {{findSelectLadder(selectLadderList, item).times ? findSelectLadder(selectLadderList, item).giftName : '未选择优惠赠品'}}
      </span>
      <a v-if=" findSelectLadder(selectLadderList, item).times">
        {{(selectLadderList, item).addMoney ? '已加价：¥' + parseFloat(findSelectLadder(selectLadderList, item).addMoney ||
        0).toFixed(2) : '已选'}}</a>
      <a v-else>去选取</a>
    </div>
     <!--返利-->
    <div v-if=" rebate.length >0 &&  (item.prefWay == 1  || item.prefWay == 2) "
         v-for="(item,index) in rebate"
         @click=" showChoseNum(item)">
      <buy-more-list pageType="cartList" slot="content" :buyMoreDetail="item">
      </buy-more-list>
    </div>

    <!--返利NG-->
    <div v-if=" rebateNG.length >0 "
         v-for="(item,index) in rebateNG"
         class="preferential" style="text-align: left">
      <label class="aui-label-danger aui-label-outlined" style="margin-left: 0.5rem">返利</label>
      <span class="cjy-sec-title">{{buyPresentDes(2, item)}}</span>
      <a v-if="item.beUsed == 1  && item.prefRange != 1" @click="goClassify(item)">去凑单</a>
      <!--<span v-else-if="item.beUsed == 3" class="cjy-sec-title">可参与次数不足</span>-->
    </div>

    <!--返利UN-->
    <div v-if=" rebateUN.length >0 "
         v-for="(item,index) in rebateUN"
         class="preferential" style="text-align: left">
      <label class="aui-label-danger aui-label-outlined" style="margin-left: 0.5rem">返利</label>
      <span class="cjy-sec-title">{{buyPresentDes(2, item)}}</span>
      <!-- <a v-if="item.beUsed == 1 " @click="goClassify(item)">去凑单</a> -->
      <!-- <span class="cjy-span">勾选后参加</span> -->
    </div>


    <!--满减-->
    <div v-if=" fullCut.length >0 "
         v-for="(item,index) in fullCut"
         class="preferential" style="text-align: left">
      <label class="aui-label-danger aui-label-outlined" style="margin-left: 0.5rem">满减</label>
      <span class="cjy-sec-title">  {{fullCutDes(1,item)}}</span>
      <span class="cjy-span">{{fullDiscountTitleDes(true, item)}}</span>
    </div>

    <!--满减-->
    <div v-if=" fullCutNG.length >0 "
         v-for="(item,index) in fullCutNG"
         class="preferential" style="text-align: left">
      <label class="aui-label-danger aui-label-outlined" style="margin-left: 0.5rem">满减</label> <span
      class="cjy-sec-title">{{fullCutDes(2,item)}}
    </span>
      <a v-if="item.beUsed == 1  && item.prefRange != 1" @click="goClassify(item)">去凑单</a>
      <!--<span v-else-if="item.beUsed == 3" class="cjy-sec-title">可参与次数不足</span>-->
    </div>

    <!--满减UN-->
    <div v-if=" fullCutUN.length >0 "
         v-for="(item,index) in fullCutUN"
         class="preferential" style="text-align: left">
      <label class="aui-label-danger aui-label-outlined" style="margin-left: 0.5rem">满减</label> <span
      class="cjy-sec-title">{{fullCutDes(3,item)}}
    </span>
      <!-- <span class="cjy-span">勾选后参加</span> -->

    </div>

    <!--满折-->
    <div v-if=" fullDiscount.length >0 "
         v-for="(item,index) in fullDiscount"
         class="preferential" style="text-align: left">
      <label class="aui-label-danger aui-label-outlined" style="margin-left: 0.5rem">折扣</label> <span
      class="cjy-sec-title"> {{fullDiscountDes(1,item)}}
    </span>
      <span class="cjy-span">{{fullDiscountTitleDes(true, item)}}</span>
    </div>

    <!--满折-->
    <div v-if=" fullDiscountNG.length >0 "
         v-for="(item,index) in fullDiscountNG"
         class="preferential" style="text-align: left">
      <label class="aui-label-danger aui-label-outlined" style="margin-left: 0.5rem">折扣</label> <span
      class="cjy-sec-title">
      {{fullDiscountDes(2,item)}}
    </span>
      <a v-if="item.beUsed == 1  && item.prefRange != 1" @click="goClassify(item)">去凑单</a>
      <!--<span v-else-if="item.beUsed == 3" class="cjy-sec-title">可参与次数不足</span>-->
    </div>

    <!--满折UN-->
    <div v-if=" fullDiscountUN.length >0 "
         v-for="(item,index) in fullDiscountUN"
         class="preferential" style="text-align: left">
      <label class="aui-label-danger aui-label-outlined" style="margin-left: 0.5rem">折扣</label> <span
      class="cjy-sec-title">
      {{fullDiscountDes(3,item)}}
    </span>
      <!-- <span class="cjy-span">勾选后参加</span> -->
    </div>


    <!--活动-->
    <div v-if=" regularVOListOK.length >0 "
         v-for="(item,index) in regularVOListOK"
         class="preferential"
         style="text-align: left">
      <label class="aui-label-danger aui-label-outlined" style="margin-left: 0.5rem">活动</label> <span
      class="cjy-sec-title">
      已购买{{item.packageName}}
    </span>
      <span class="cjy-span">已选</span>
    </div>

    <!--活动-->
    <div v-if=" regularVOListNG.length >0 "
         v-for="(item,index) in regularVOListNG"
         class="preferential"
         style="text-align: left">
      <label class="aui-label-danger aui-label-outlined"
             style="margin-left: 0.5rem">活动</label>
      <span class="cjy-sec-title">组合购买更优惠 </span>
      <a @click=" $router.push({path:'regulardetail',query:{regularId:item.regularId ,regularPackageId:item.regularPackageId }})  ">去凑单</a>
    </div>
    <!--活动UN-->
    <div v-if=" regularVOListUN.length >0 "
         v-for="(item,index) in regularVOListUN"
         class="preferential"
         style="text-align: left">
      <label class="aui-label-danger aui-label-outlined"
             style="margin-left: 0.5rem">活动</label>
      <span class="cjy-sec-title">组合购买更优惠 </span>
    </div>

    <!--套餐-->
    <div v-if=" fixedPackageListOK.length >0 "
         v-for="(item,index) in fixedPackageListOK"
         class="preferential"
         style="text-align: left">
      <label class="aui-label-danger aui-label-outlined"
             style="margin-left: 0.5rem">套餐</label>
      <span class="cjy-sec-title">已购买{{item.packageName}}，享受优惠
    </span>
      <span class="cjy-span">已选</span>
    </div>

    <!--套餐-->
    <div v-if=" fixedPackageListNG.length >0 "
         v-for="(item,index) in fixedPackageListNG"
         class="preferential"
         style="text-align: left">
      <label class="aui-label-danger aui-label-outlined" style="margin-left: 0.5rem">套餐</label> <span
      class="cjy-sec-title">组合购买更优惠
    </span>
      <!-- <a @click=" $router.push({path:'regulardetail',query:{fixedPackageId:item.fixedPackageId}}) ">去凑单</a> -->
    </div>


  </div>
</template>

<script>
  import {Toast} from '@/utils/toast'
  import {queryDisount} from '@/utils/ReturnAxios'
  import BuyMoreList from './BuyMoreList.vue'
  import CartShowRegular from '@/real-components/CartShowRegular'

  export default {
    data() {
      var promotionalKeyList = [
        'buyPresent',//单品 买赠
        'specialOffer',// 单品 特价
        'discount', //单品 折扣
        'overBuy',//单品 多买
        'rebate', // 订单返利
        'fullCut',// 满减
        'fullDiscount',//满折
      ] // 配置所有活动的类型


      var dataObj = {}
      for (var key of promotionalKeyList) {
        dataObj[key] = []
        dataObj[key + 'NG'] = []
        dataObj[key + 'UN'] = []
      }
      return {
        ...dataObj,
        promotionalVoListNG: [],
        promotionalVoListOK: [],
        promotionalVoListUN: [],
        regularVOListNG: [],
        regularVOListOK: [],
        regularVOListUN:[],
        fixedPackageListOK: [],
        fixedPackageListNG: [],
        promotionalKeyList,
        ladderList: [],
        ladder: [],
        buyMoreList: 0,
        goodsClassCode: ''
      }
    },
    components: {
      BuyMoreList,
      CartShowRegular
    },
    props: {
      brandName: {
        type: String,
        default: ''
      },
      ishShowDisable: {
        type: Boolean,
        default: true
      },
      goodsCode: {
        type: String,
        default: ''
      },
      goodsType: {
        default: 1
      },
      goodsUnit: {
        type:String,
        default: '件'
      },
      type: {
        type: String,
        default: ''
      },
      prodVo: {
        type: Object,
        default: () => {
        }
      },
      couponListCanBeUsed: {
        type: Array,
        default: () => []
      },
      couponListCanBeGet: {
        type: Array,
        default: () => []
      },
      cartFoodregular: {
        type: Boolean,
        default: false,
      },
      regularType: {
        type: String,
        default: ''
      }
    },
    methods: {
      //当 订单活动不满足的情况下跳转分类
      goClassify(item) {
        console.log(item,'iiiiiii3333')
        if (this.$route.name == 'CartForOffLine') {
          this.$emit('searchCode')
          return
        }
        let activeInfor = {
          numOrMoneyShort:item.numOrMoneyShort,
          goodsType:this.goodsType,
          goodsUnit:this.goodsUnit,
        }
        this.$store.commit('lyj/SET_ACTIVEINFOR',activeInfor)
        console.log(item,'1:商品活动,2:分类活动,3:品牌活动,4:全场活动')
        var prefRange = item.prefRange  //活动类型
        var brandName = this.brandName
        var prodVo = this.prodVo
        switch (prefRange) {
          case 1 :
            ;
          case 6 :
            this.cartFoodregular == true ? this.$router.push({path: 'couponFoodGoods', query: {goodsCode: prodVo.goodsCode,promCode:item.promCode}}) 
            : this.$router.push({path: 'couponGoods', query: {goodsCode: prodVo.goodsCode,promCode:item.promCode}});
            break;
          case 2:
            ;
          case 5 :
            this.cartFoodregular == true ?this.$router.push({path: 'couponFoodGoods', query: {goodsCode: prodVo.goodsCode,promCode:item.promCode}})
             : this.$router.push({path: 'couponGoods', query: {goodsCode: prodVo.goodsCode,promCode:item.promCode}});
            break;
          case 3:
            this.cartFoodregular == true ? this.$router.push({path: 'couponFoodGoods', query: {goodsCode: prodVo.goodsCode,promCode:item.promCode}})
             : this.$router.push({path: 'couponGoods', query: {goodsCode: prodVo.goodsCode,promCode:item.promCode}});
            break;
          case 4:
            this.cartFoodregular == true ? this.$router.push({path: 'couponFoodGoods', query: {goodsCode: prodVo.goodsCode,promCode:item.promCode}})
             : this.$router.push({path: 'couponGoods', query: {goodsCode: prodVo.goodsCode,promCode:item.promCode }});
            break;
          default:
            ;
            break
        }
      },

      
      translateName() {
      },
      //标题提示

      overBuyDes(num, item) {
        if (item.prefWay != 1) {
          return '多买多优惠'
        }
        var x, n, z, unit, method, methodUnit
        x = item.fullCondition

        if (item.minusNum) {
          n = item.minusNum
          method = '减'
          unit = this.goodsType == 6 || this.goodsType == 7 ? 'kg' : '件'
          methodUnit = unit
        } else if (item.minusSale) {
          n = item.minusSale
          method = '打'
          unit = this.goodsType == 6 || this.goodsType == 7 ? 'kg' : '件'
          methodUnit = '折'
        }
        z = unit == '元' ? parseFloat(item.numOrMoneyShort || 0).toFixed(2) : parseFloat(item.numOrMoneyShort || 0)


        if (num==1) {
          return `已购满${x + unit}，享受优惠`
        } else if(num==2) {
          return `满${x + unit + method + n + methodUnit}，还差${z + unit}`
        } else {
           return `满${x + unit + method + n + methodUnit}`
        }
        
      },

      buyPresentDes(num, item) {
        var x, n, z, util, giftName
        if (item.prefWay != 1) {
          return '多买多优惠'
        }
        x = item.fullCondition || parseFloat(item.fullElement || 0).toFixed(2)
        n = item.minusMoney
        z = parseFloat(item.numOrMoneyShort || 0).toFixed(2)
        giftName = item.giftVO ? item.giftVO.giftName : item.couponVO ? item.couponVO.couponName : ''
        var addMoney = item.giftVO ? item.giftVO : 0
        util = this.goodsType == 6 || this.goodsType == 7 ? 'kg' : '件'
        util = item.fullElement ? '元' : util
        if (num == 1) {
          return `已购满${x + util}，获得 ${giftName }`
        } else if (num==2) {
          return `满${x + util}，享受优惠`
        } else {
           return `满${x + util}，可获得 ${giftName }`
        }
       
      },

      fullCutDes(num, item) {
        var x, n, z
        x = item.fullElement
        n = item.minusMoney
        z = parseFloat(item.numOrMoneyShort || 0).toFixed(2)
        if (item.prefWay != 1) {
          return '多买多优惠'
        }

        if (num == 1) {
          return `已购满${x}元，享受优惠`

        } else if (num==2) {
          return `满${x}元减${n}元，还差${z}元`
        } else {
          return `满${x}元减${n}元`
        }
        
      },

      fullDiscountDes(num, item) {

        var x, n, z
        x = item.fullElement
        n = item.discount
        z = parseFloat(item.numOrMoneyShort || 0).toFixed(2)
        if (item.prefWay != 1) {
          return '多买多优惠'
        }

        if (num==1) {
          return `已购满${x}元，享受优惠`

        } else if (num == 2) {
           return `满${x}元打${n}折，还差${z}元`
        } else {
           return `满${x}元打${n}折`
        }
       

      },

      fullDiscountTitleDes(isOK, item) {
        var resultMinusMoney = item.resultMinusMoney
        var resultMinusSale = item.resultMinusSale

        if (resultMinusMoney) {
          return '已优惠¥' + resultMinusMoney
        } else if (resultMinusSale) {
          return '已打' + resultMinusSale + '折'
        } else {
          return '已满足'
        }
      },
      //回显已选礼品
      findSelectGift(selectLadderList, item) {
        var returnData
        var promLadderId
        var ladder = item
        // 选出promId
        var goodsCode = this.goodsCode
        var promId = ladder.promId
        var isCommercialActivities = item.prefRange == 1 // 是否是单独商品活动
        returnData = selectLadderList.find((item) => {
          return promId == item.promId && (!isCommercialActivities || item.goodsCode == goodsCode)
        })

        if (returnData) {
          promLadderId = returnData.promLadderId

          var findLadderList = item.promotLadderVOList.find((item) => {
            return promLadderId == item.promLadderId
          })
          if (findLadderList) {
            if (findLadderList.giftVO.times > 0) {
              return returnData
            } else {
              this.$store.commit('cjy/SPLICE_SELECT_BUY_MORE_LIST', promId)
            }
          }
        }

        return {}


      },


      //回显已选 换购
      findSelectLadder(selectLadderList, item) {
        var returnData
        var promLadderId
        var ladder = item
        // 选出promId
        var promId = ladder.promId
        // 查找已选择列表中对应的Id
        returnData = selectLadderList.find((item) => {
          return promId == item.promId //选取出对应的已选加赠
        })
        if (returnData) {
          promLadderId = returnData.promLadderId

          var findLadderList = item.promotLadderVOList.find((item) => {
            return promLadderId == item.promLadderId
          })
          if (findLadderList) {
            var returnObj
            var addMoney = findLadderList.addMoney
            var giftVO = findLadderList.giftVO
            var couponVO = findLadderList.couponVO
            if (giftVO && giftVO.times > 0) {
              return {
                addMoney,
                giftName: giftVO.giftName,
                times: giftVO.times
              }
            } else if (couponVO && couponVO.times > 0) {
              return {
                addMoney,
                giftName: couponVO.couponName,
                times: couponVO.times
              }
            }
            else {
              this.$store.commit('cjy/SPLICE_SELECT_LADDER_LIST', promId)
            }
          }

        }
        return {}

      },


      // 弹出优惠券领取
      async getDiscountCoupon() {
        this.$emit('getDiscountCoupon')
      },
      //初始化 每种活动的数据
      initData(data) {
        if (!data) {
          return
        }
        var promotionalVoList = data.promotionalVoList || []
        var ishShowDisable = this.ishShowDisable
        this.goodsClassCode = data.classCode
        this.promotionalVoListNG = ishShowDisable ? promotionalVoList.filter((item) => {
          return item.beUsed == 1 && (this.regularType !== 'goods' || (item.prefRange == 1 && this.prodVo.selected))
        }) : []
        this.promotionalVoListOK = this.filter = promotionalVoList.filter((item) => {
          return item.beUsed == 2 && (this.regularType !== 'goods' || (item.prefRange == 1 && this.prodVo.selected))
        })
        this.promotionalVoListUN = this.filter = promotionalVoList.filter((item) => {
          return this.prodVo.selected == 0 && this.regularType == 'goods' && this.regularType !== 4
        })
        this.regularVOListOK = []
        this.regularVOListNG = []
        this.regularVOListUN = []
        var regularVOListOK = !this.type ? this.getRegular(data.regularVOListOK) : []
        regularVOListOK.map( item => {
          if (this.prodVo.selected) {
            this.regularVOListOK.push(item)
          }else {
            this.regularVOListUN.push(item)
          }

        })
      
        var regularVOListNG= ishShowDisable && data.regularVOListNG.length > 0 && !this.type ? this.getRegular(data.regularVOListNG) : []
        regularVOListNG.map (item => {
          if (this.prodVo.selected) {
            this.regularVOListNG.push(item)
          }else {
            this.regularVOListUN.push(item)
          }
        })

        this.fixedPackageListOK = data.fixedPackageListOK ? data.fixedPackageListOK : []
        this.fixedPackageListNG = ishShowDisable && data.fixedPackageListNG ? data.fixedPackageListNG : []
        this.initRegular()
      },
      //初始化活动
      initRegular() {
        //promName
        var promotionalKeyList = this.promotionalKeyList
        for (var key of promotionalKeyList) {
          //筛选符合
          this[key] = this.promotionalVoListOK.filter(
            (item) => {
              return key == item.saleType
            })
          //筛选 不符合
          this[key + 'NG'] = this.promotionalVoListNG.filter(
            (item) => {
              return key == item.saleType
            }
          )
          this[key + 'UN'] = this.promotionalVoListUN.filter(
            (item) => {
              return key == item.saleType
            }
          )
        }
        console.log('////////////', this.fullCutUN)
      },
      //弹出 阶梯换购
      showSelectLadder(item) {
        this.$emit('showSelectLadder', item)
      },
      //弹出 阶梯礼品
      showBuyMoreLadder(item) {
        var config = {
          ladderList: item,
          goodsCode: this.goodsCode
        }
        this.$emit('showBuyMoreLadder', config)
      },
      //弹出 每满赠
      showChoseNum(item) {
        this.$emit('showChoseNum', item)

      },

      //弹出 免费赠品
      showFree(item) {
        this.$emit('showFree', item)
      },
      //组套餐筛选
      getRegular(data) {
        var regular = []
        for (var list  of data) {
          var activityName = list.activityName
          for (var item of list.regularPackageList) {
            item.activityName = activityName
            regular.push(item)
          }
        }
        return regular
      },
      //转换可用优惠券格式
      translateCouponListCanBeUsed(data) {
        var count = 0

        data.map((item) => {
          count += item.couponCodeList.length || 0
        })
        return count
      },

    },
    watch: {
      prodVo(data) {

        this.initData(data)
      }
      ,
      fullCutUN(data) {
        console.log('fullCutUN????????????????????', data)
      }
    }
    ,
    computed: {
      buyMoreData() {
        return this.$store.getters['cjy/buyMoreData']
      },

      selectLadderList() {
        return this.$store.getters['cjy/selectLadderList']
      },

      selectGiftList() {
        return this.$store.getters['cjy/selectGiftList']
      },
    }
    ,
    created() {
      var prodVo = this.prodVo
      this.initData(prodVo)
    }
    ,
    selectJia() {
      PSEvent.trigger("selectJia");
    }
  }
</script>

<style scoped>


  .cjy-sec-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    margin-left: 0.5rem;
    vertical-align: middle;
    flex: 1;
  }

  .preferential {
    padding: 0.3rem 0;
    line-height: 1rem;
    background: #FFF3EE;
    display: flex;
    height: 1.6rem;
  }

  .preferential label {
    line-height: 1rem;
    padding: 0 0.1rem;
  }

  .preferential a {
    padding-right: 1rem;
    margin-top: 0;
  }

  .preferential a:before {
    right: 0.5rem;
    top: 50%
  }

  .preferential .cjy-span, .preferential .cjy-add-sub {
    padding-right: 1rem;
    color: #EF5423;
  }


</style>
<style>

  .aui-label-outlined.aui-label-danger, .aui-label-outlined.aui-label-danger:after {
    color: #EF5423;
    border-color: #EF5423;
  }

</style>
